﻿;/* Pra.ui Javascript Updated: Thu 3.10.08 @ 10:33 p.m. Author: Chencheng (sorrycc@gmail.com) —————————————————-*/(function (){


	var $=window.jQuery?window.jQuery:null;
	var c=Pui.albums={
		clickcount:0,
		albumID:"",
		albumName:"",
		newalbumName:"",
		loadScript:function (a,b){
			var o={
				random:true
			};
			if(b)$.extend(o,b);
			var f=document.createElement('script');
			f.type='text/javascript';
			var d=new Date();
			if(o.random){
				if(a.match(/.*\?./)){
					a=a+'&random='+d.getTime()+parseInt(Math.random()*10000)
				}else {
					a=a+'?random='+d.getTime()+parseInt(Math.random()*10000)
				}
			}f.src=a;
			$('head')[0].appendChild(f)
		},
		createAlbum2:function()
		{
				//getAbsPoint();
				document.getElementById("message_tr2").innerHTML="";
				$('#AlbumCreate2').show(10, function(){ 
				$('#AlbumCreate2').showDiv();
				}); 
		},
		add2:function()
			{
				if(document.getElementById("txtAlbumName2").value.trim()=="")
				{
					document.getElementById("message_tr2").innerHTML="相册名字不可以为空！";
					document.getElementById("txtAlbumName2").focus();
					return false;
				}
				else
				{
					if(fucCheckLength(document.getElementById("txtAlbumName2").value) > 20 )
					{
						document.getElementById("message_tr2").innerHTML="相册名字不可以超过10个汉字！";
						document.getElementById("txtAlbumName2").focus();
						return false;
					}
				}
				var result = managealbum.addAlbum(document.getElementById("txtAlbumName2").value.trim()).value;
				if ( result == 1 )
				{
					document.getElementById("txtAlbumName2").value="";
					$('#AlbumCreate2').hideDiv();  //关闭大层
					//Pui.albums.ui.overlay();//关闭大层
					document.getElementById("other_album").innerHTML=managealbum.getOtherAlbum(document.getElementById("hid_id").value).value;
						$('#AlbumDelete2').show(10, function(){ 
							$('#AlbumDelete2').showDiv();
						}); 
				}
				if ( result == 3 )
				{
					document.getElementById("message_tr2").innerHTML="该相册已存在！";
				}
		},
		modifyName:function(id,album)
		{
				this.albumID=id;
				this.albumName=album;
				if( this.clickcount == 0 )
				{
					document.getElementById("span_albumname"+this.albumID).innerHTML="<input type=\"text\" id=\"newalbumname"+this.albumID+"\" onblur=\"Pui.albums.on_blur();\" name=\"newalbumname\" value='"+this.albumName+"' maxLength=\"20\" size=\"10\" />";
					document.getElementById("newalbumname"+this.albumID).focus();
					clickcount=1;
				}
				else
				{
					document.getElementById("span_albumname"+this.albumID).innerHTML="<a href=\"img.aspx?albumid="+this.albumID+"&albumname="+escape(this.albumName)+"\">"+this.albumName+"</a>";
					this.clickcount=0;
				}
		},
		on_blur:function()
		{
				this.newalbumName=document.getElementById("newalbumname"+this.albumID).value;
				this.clickcount=0;
				document.getElementById("span_albumname"+this.albumID).innerHTML="<a href=\"img.aspx?albumid="+this.albumID+"&albumname="+escape(this.newalbumName)+"\">"+this.newalbumName+"</a>";
				if(this.albumName==this.newalbumName){return} 
				this.modify_AlbumName();
		},
		modify_AlbumName:function()
		{
				//getAbsPoint();
				if (this.modifycheckinput(Pui.albums.newalbumName) == false) {
					return;
				}
				
				//var albumName = document.getElementById("newalbumname"+albumID).value;
				var result = managealbum.modifyAlbumName(Pui.albums.albumID,Pui.albums.newalbumName).value;
				if ( result == 2 )
				{
					$('#AlbumName_').show(10, function(){ 
							$('#AlbumName_').showDiv();
						}); 
				}
				else
				{
					document.getElementById("span_albumname"+this.albumID).innerHTML="<span id=\"span_albumname"+this.albumID+"\">"+this.newalbumName+"</span>";
				}
				window.location.reload();
		},
		closeDiv:function(divName)
		{
				var div_Name = "#"+divName;
				$(div_Name).hideDiv();  //关闭大层
				//Pui.albums.ui.overlay();
		},
		closeDiv2:function(divName)
		{
			var div_Name = "#"+divName;
			$(div_Name).hideDiv();  //关闭大层
		},
			//删除相册
		deleteAlbum:function ( albumID,albumName,photoNum ) 
		{
			
			//getAbsPoint();
			document.getElementById("hid_id").value=albumID;
			document.getElementById("Hid_albumName").value=albumName;
			document.getElementById("Hid_photoNum").value=photoNum;
			
			if ( photoNum > 0 ) //有照片
			{
				if ( albumName == "" )
				{
					document.getElementById("delete_albumname_2").innerHTML="该";
				}
					else
				{
					document.getElementById("delete_albumname_2").innerHTML="["+albumName+"]";
				}
					document.getElementById("delete_album_count").innerHTML="\""+photoNum+"\"";
					//$('#AlbumDelete2').show();
					$('#AlbumDelete2').dialog({bgColor:'#000000',opacity:0.12});
					document.getElementById("other_album").innerHTML=managealbum.getOtherAlbum(albumID).value;
					//$('#AlbumDelete2').show(10, function(){ 
					//	$('#AlbumDelete2').showDiv();
					//}); 
			}else //无照片
			{
				if ( albumName == "" )
				{
					document.getElementById("delete_albumname").innerHTML="该";
				}else{
					document.getElementById("delete_albumname").innerHTML="["+albumName+"]";
				}
						//$('#AlbumDelete').show(10, function(){ 
					$('#AlbumDelete').showDiv();
						//}); 
						//Pui.albums.ui.overlay();
			}
		},
		delete_userAlbum_n:function(){
			this.delete_useralbum(document.getElementById("hid_id").value);
			$('#AlbumDelete').hideDiv();  //关闭大层
			window.location.reload();
		},
		//有照片
		deletealbum_movephoto:function (){
			var result = managealbum.getAlbumCount().value;
			if ( result > 1 )
			{
				var movealbumID = document.getElementById("otheralbum").value;
				var deleteType = 0;
				if ( document.getElementById("radio_movephoto_yes").checked )
				{
					deleteType =1;
				}else{
					deleteType=2;
				}
				var albumID = document.getElementById("hid_id").value;
				if ( deleteType == 1 ){
					if ( movealbumID == -1 )
					{
						document.getElementById("message_move").innerHTML="请选择移动到的相册";
						return false;
					}
				}
				this.delete_MovePhoto(albumID,movealbumID,deleteType);//删除类型 deleteType，1、移动，不删除相片，2、连相片一起删除
				$('#AlbumDelete2').hideDiv();  //关闭大层
				//Pui.albums.ui.overlay();
			}else{
				if ( document.getElementById("radio_movephoto_yes").checked )
				{
					$('#AlbumDelete2').hideDiv();  //关闭大层
					//Pui.albums.ui.overlay();
					this.createAlbum2();
				}else{
					var movealbumID = document.getElementById("otheralbum").value;
					var deleteType = 0;
					if ( document.getElementById("radio_movephoto_yes").checked )
					{
						deleteType =1;
					}else{
						deleteType=2;
					}
					if ( deleteType == 1 ){
						if ( movealbumID == -1 ){
							document.getElementById("message_move").innerHTML="请选择移动到的相册";
							return false;
						}
					}
					var albumID = document.getElementById("hid_id").value;
					this.delete_MovePhoto(albumID,movealbumID,deleteType);//删除类型 deleteType，1、移动，不删除相片，2、连相片一起删除
					$('#AlbumDelete2').hideDiv();  //关闭大层
						//Pui.albums.ui.overlay();
				}
			}
		},
			//无照片
		delete_useralbum:function (albumID)
		{
				this.delete_MovePhoto(albumID,-1,2);//删除类型 deleteType，1、移动，不删除相片，2、连相片一起删除
				//Pui.albums.ui.overlay();
				$("#MarkID").hide();
		},
			//需要删除的相册里有照片，需转移
		delete_MovePhoto:function ( albumID,movealbumID,deleteType )
		{
				managealbum.deleteAlbum(albumID,movealbumID,deleteType);
				window.location.reload();
		},
		changeisPublic_Y:function ()
		{
				managealbum.isPublicAlbum(document.getElementById("hid_id").value,1);
				$('#AlbumPub').hideDiv(); 
				//Pui.albums.ui.overlay();
		},
		changeisPublic_N:function ()
		{
				managealbum.isPublicAlbum(document.getElementById("hid_id").value,2);
				$('#AlbumHid').hideDiv(); 
				//Pui.albums.ui.overlay();
		},
			//公开或者隐藏相册
		isPublicAlbum:function ( albumID,ispublic )
		{
				//getAbsPoint();
				document.getElementById("hid_id").value=albumID;
				if ( ispublic == 1 )  
				{
					$('#AlbumPub').show(10, function(){ 
							$('#AlbumPub').showDiv();
						}); 
				}
				if ( ispublic == 2 ) 
				{
					$('#AlbumHid').show(10, function(){ 
							$('#AlbumHid').showDiv();
						}); 
				}
		},
		showAlbumList:function ()
		{
				document.getElementById("MyAlbum").innerHTML=managealbum.getAlbumList(document.getElementById("hid_curpage").value).value;
		},
		checkinput:function ()
		{
				if(document.getElementById("txtAlbumName").value.trim()=="")
				{
					document.getElementById("message_tr2").innerHTML="相册名字不可以为空！";
					document.getElementById("txtAlbumName").focus();
					return false;
				}
				else
				{
					if(fucCheckLength(document.getElementById("txtAlbumName").value) > 20 )
					{
						document.getElementById("message_tr2").innerHTML="相册名字不可以超过10个汉字！";
						document.getElementById("txtAlbumName").focus();
						return false;
					}
				}
				return true;
		},
		checkinput2:function ()
		{
				if(document.getElementById("txtAlbumName2").value.trim()=="")
				{
					alert("相册名字不可以为空！");
					document.getElementById("txtAlbumName2").focus();
					return false;
				}
				else
				{
					if(fucCheckLength(document.getElementById("txtAlbumName2").value) > 20 )
					{
						alert("相册名字不可以超过10个汉字！");
					document.getElementById("txtAlbumName2").focus();
					return false;
					}
				}
				return true;
		},
		fucCheckLength:function (strTemp)
		{
				var i,sum;
				sum=0;
				for(i=0;i<strTemp.length;i++)
				{
				if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255))
				sum=sum+1;
				else
				sum=sum+2;
				}
				return sum;
		},
		modifycheckinput:function (newalbumName)
		{
				//getAbsPoint();
				if(newalbumName.trim()=="")
				{
					$('#AlbumNameisNull').show(10, function(){ 
							$('#AlbumNameisNull').showDiv();
						}); 
					//document.getElementById("newalbumname").focus();
					return false;
				}
				else
				{
					if(this.fucCheckLength(newalbumName) > 20 )
					{
					$('#AlbumNameisLong').show(10, function(){ 
							$('#AlbumNameisLong').showDiv();
						}); 
					//document.getElementById("newalbumname").focus();
					return false;
					}
				}
				return true;
		},
		fucCheckLength:function (strTemp)
		{
			var i,sum;
			sum=0;
			for(i=0;i<strTemp.length;i++)
			{
			if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255))
			sum=sum+1;
			else
			sum=sum+2;
			}
			return sum;
		},
		no_delete:function ()
		{
			document.getElementById("movephoto").style.display="none";
		},
		canceled:function ()
		{
			document.getElementById("createAlbum_div").style.display="none";
		},
		closeDiv_sipublic:function (divName)
		{
			var div_Name = "#"+divName;
			$(div_Name).hideDiv();  //关闭大层
			//Pui.albums.ui.overlay();
			window.location.reload();
		},
		album_name_2:function (divName)
		{
			var div_Name = "#"+divName;
			$(div_Name).hideDiv();  //关闭大层
			//alert(albumID)
			document.getElementById("span_albumname"+this.albumID).innerHTML="<a href=\"img.aspx?albumid="+this.albumID+"&albumname="+escape(this.albumName)+"\">"+this.albumName+"</a>";
			//Pui.albums.ui.overlay();
		},
		init: function(){
			$("#MyAlbum img").esizeImage();
		},
		mPhotoBlankReset: function() {
			if ($('#MyAlbum .blank')[0]) $('#MyAlbum .blank').remove();
				for (var i=0; i<$('#MyAlbum .mAlbum').length; i++)
				if ((i+2)%5 == 0) { $('#MyAlbum .mAlbum').eq(i).after('<div class="mAlbum blank" style="margin:0; width:0; border:0; overflow:hidden"'); }
				if (($('#MyAlbum .mAlbum').length)%5 != 0) $('#MyAlbum').append('<div class="mAlbum blank" style="margin:0; width:0; border:0; overflow:hidden"');
		}
	};
	c.pg=$.extend($.fn,{
		esizeImage:function (a){
			var o={
				width:120,height:90
			};
			if(a)$.extend(o,a);
			return $(this).each(function (){
				var w=this.width/o.width;
				var h=this.height/o.height;
				if(w>h){
					this.width=o.width;
					this.height=h/w*o.height
				}else {
					this.height=o.height;
					this.width=w/h*o.width
				}
			})
		}
	});

})();



(function (){
	Pui.albums.ui={
		drag:function (a,o){
			if(!o)var o={
				
			};
			this.element=a;
			this.options={
				
			};
			$.extend(this.options,o);
			$.extend(this.options,{
				handle:o.handle?($(o.handle,a)[0]?$(o.handle,a):$(a)):$(a),helper:o.helper||'original'
			});
			o=this.options;
			var b=this;
			this.mousedownfunc=function (e){
				return b.click.apply(b,[e])
			};
			o.handle.bind('mousedown',this.mousedownfunc)
		},
		sort:function (a,o){
			if(!o)var o={
				
			};
			this.element=a;
			var b=this;
			this.options={
				
			};
			$.extend(this.options,o);
			$.extend(this.options,{
				items:o.items||'> li',_drag:function (h,p,c,t,e){
					b.drag.apply(t,[b,e])
				}
			});
			o=this.options;
			var d=$(o.items,a),set=[];
			d.each(function (){
				set.push(this)
			});
			this.m=set;
			d.drag(o)
		}
	};
	$.extend(Pui.albums.ui.sort.prototype,{
		init:false,drag:function (a,e){
			var e=e||window.event,found=null,max_distance=1000000000;
			for(var i=0;i<a.m.length;i++){
				var b=a.m[i];
				if(this.element==b)continue;
				var c=Math.sqrt(Math.pow(e.clientX-$(b).offset().left,2)+Math.pow(e.clientY+document.documentElement.scrollTop-$(b).offset().top,2));
				if(c<max_distance){
					max_distance=c;
					found=b
				}
			}if(found!=null){
				if(!$(found).next()[0]||found.nextSibling==this.helper){
					var d=Math.sqrt(Math.pow(e.clientX-($(b).offset().left+b.offsetWidth),2)+Math.pow(e.clientY-$(b).offset().top,2));
					$(this.helper).insertBefore(found);
					return 
				}else {
					$(this.helper).insertBefore(found)
				}
			}
		}
	});
	$.extend(Pui.albums.ui.drag.prototype,{
		init:false,click:function (e){
			if(e.which!=1)return true;
			var a=this.element;
			var b=this;
			b.opos=[e.clientX,e.clientY];
			b.rpos=[a.offsetLeft,a.offsetTop];
			this.mousemove=function (e){
				return b.drag.apply(b,[e])
			};
			this.mouseup=function (e){
				return b.stop.apply(b,[e])
			};
			document.onmousemove=this.mousemove;
			document.onmouseup=this.mouseup;
			if($.browser.msie)a.onselectstart=function (){
				return false
			}
		},
		drag:function (e){
			var e=e||window.event,o=this.options;
			this.pos=[e.clientX+(this.rpos[0]-this.opos[0]),e.clientY+(this.rpos[1]-this.opos[1])];
			$(this.element).css({
				left:this.pos[0],top:this.pos[1]
			});
			if(!this.init)this.start.apply(this,[e]);
			if(o._drag){
				o._drag.apply(this.element,[this.helper,this.pos,o.cursorAt,this,e])
			}
		},
		start:function (e){
			var e=e||window.event;
			var o=this.options,a=this.element;
			this.helper=typeof(o.helper)=='function'?$(o.helper.apply(a,[e,this]))[0]:(o.helper=='clone'?$(a).clone()[0]:a);
			$(this.helper).insertBefore(a);
			this.init=true;
			$(a).css({
				position:'absolute',zIndex:9999,left:this.rpos[0],top:this.rpos[1]
			});
			if(o.opacity){
				$(a).css('opacity',o.opacity)
			}$(document.body).css('cursor','move')
		},
		stop:function (){
			var a=this.element,self=this,o=this.options;
			this.init=false;
			this.pos=this.opos=this.rpos=null;
			document.onmousemove=null;
			document.onmouseup=null;
			var b=function (){
				$(document.body).css('cursor','');
				$(a).css({
					position:'',zIndex:'',left:'',top:'',opacity:''
				});
				if(self.helper&&self.helper!=a){
					$(a).insertAfter(self.helper);
					$(self.helper).remove();
					self.helper=null
				}if(o.callback){
					o.callback()
				}
			};
			if(o.animate){
				$(a).animate({
					left:this.rpos[0],top:this.rpos[1]
				},300,b);
				return false
			}b();
			return false
		}
	});
	$.extend(Pui.albums.pg,{
		drag:function (o){
			return this.each(function (){
				new Pui.albums.ui.drag(this,o)
			})
		},sort:function (o){
			return this.each(function (){
				new Pui.albums.ui.sort(this,o)
			})
		}
	})
})();

/*
 * 
 * **
 **/
/*
			function createAlbum()
			{
				//getAbsPoint();
				document.getElementById("message_tr").innerHTML="";
				$('#AlbumCreate').show(10, function(){ 
				$('#AlbumCreate').showDiv();
				}); 
			}
			function add()
			{
				//if(checkinput()==false)return;
				if(document.getElementById("txtAlbumName").value.trim()=="")
				{
					document.getElementById("message_tr").innerHTML="相册名字不可以为空！";
					document.getElementById("txtAlbumName").focus();
					return false;
				}
				else
				{
					if(fucCheckLength(document.getElementById("txtAlbumName").value) > 20 )
					{
						document.getElementById("message_tr").innerHTML="相册名字不可以超过10个汉字！";
						document.getElementById("txtAlbumName").focus();
						return false;
					}
				}
				var result = managealbum.addAlbum(document.getElementById("txtAlbumName").value.trim()).value;
				if ( result == 1 )
				{
					document.getElementById("txtAlbumName").value="";
					$('#AlbumCreate').hide();  //关闭大层
					Pui.albums.ui.overlay();//关闭大层
					//showAlbumList();
					window.location.reload();
				}
				if ( result == 3 )
				{
					document.getElementById("message_tr").innerHTML="该相册已存在！";
				}
			}*/
			
			
			

			//修改相册名字
			/*
			var clickcount=0;
			function modifyName(albumID,albumName)
			{
				if( clickcount == 0 )
				{
					document.getElementById("span_albumname"+albumID).innerHTML="<input type=\"text\" id=\"newalbumname"+albumID+"\" onblur=\"on_blur("+albumID+",'"+albumName+"');\" name=\"newalbumname\" onchange=\"modify_AlbumName("+albumID+");\" value='"+albumName+"' maxLength=\"20\" size=\"10\" />";
					document.getElementById("newalbumname"+albumID).focus();
					clickcount=1;
				}
				else
				{
					document.getElementById("span_albumname"+albumID).innerHTML="<a href=\"img.aspx?albumid="+albumID+"&albumname="+escape(albumName)+"\"><span id=\"span_albumname"+albumID+"\">"+albumName+"</span></a>";
					clickcount=0;
				}
			}
			/*
			function on_blur(albumID,albumName)
			{
				clickcount=0;
				document.getElementById("span_albumname"+albumID).innerHTML="<a href=\"img.aspx?albumid="+albumID+"&albumname="+escape(albumName)+"\"><span id=\"span_albumname"+albumID+"\">"+albumName+"</span></a>";
			}
			*/
			
			
			
			
			
			
			
			
			
			
			

var requests = new Array();

if(typeof(XMLHttpRequest) == 'undefined')
var XMLHttpRequest = function()
{
	var request = null;
	try
	{
		request = new ActiveXObject('Msxml2.XMLHTTP');
	}
	catch(e)
	{
		try
		{
			request = new ActiveXObject('Microsoft.XMLHTTP');
		}
		catch(ee)
		{}
	}
	return request;
}

function ajax_stop()
{
	for(var i=0; i<requests.length; i++)
	{
		if(requests[i] != null)
			requests[i].abort();
	}
}

function ajax_create_request(context)
{
	for(var i=0; i<requests.length; i++)
	{
		if(requests[i].readyState == 4)
		{
			requests[i].abort();
			requests[i].context = context;
			return requests[i];
		}
	}

	var pos = requests.length;
	
	requests[pos] = Object();
	requests[pos].obj = new XMLHttpRequest();
	requests[pos].context = context;
	
	return requests[pos];
}

function ajax_request(url, data, callback, context)
{
	var request = ajax_create_request(context);
	var async = typeof(callback) == 'function';

	if(async) request.obj.onreadystatechange = function()
	{
		if(request.obj.readyState == 4)
			callback(new ajax_response(request));
	}
	
	request.obj.open('POST', url, async);
	request.obj.send(data);
	
	if(!async)
		return new ajax_response(request);
}

function ajax_response(request)
{
	this.request = request.obj;
	this.error = null;
	this.value = null;
	this.context = request.context;
	
	if(request.obj.status == 200)
	{
		try
		{
			this.value = object_from_json(request);
			
			if(this.value && this.value.error)
			{
				this.error = this.value.error;
				this.value = null;
			}
		}
		catch(e)
		{
			this.error = new ajax_error(e.name, e.description, e.number);
		}
	}
	else
	{
		this.error = new ajax_error('HTTP request failed with status: ' + request.obj.status, request.obj.status);
	}
	
	return this;
}

function enc(s)
{
	return s.toString().replace(/\%/g, "%26").replace(/=/g, "%3D");
}

function object_from_json(request)
{
	if(request.obj.responseXML != null && request.obj.responseXML.xml != null && request.obj.responseXML.xml != '')
		return request.obj.responseXML;
	
	var r = null;	
	eval('r=' + request.obj.responseText + ';');
	return r;
}

function ajax_error(name, description, number)
{
	this.name = name;
	this.description = description;
	this.number = number;

	return this;
}

ajax_error.prototype.toString = function()
{
	return this.name + " " + this.description;
}

function json_from_object(o)
{
	if(o == null)
		return 'null';

	switch(typeof(o))
	{
		case 'object':
			if(o.constructor == Array)		// checks if it is an array [,,,]
			{
				var s = '';
				for(var i=0; i<o.length; ++i)
				{
					s += json_from_object(o[i]);

					if(i < o.length -1)
						s += ',';
				}

				return '[' + s + ']';
			}
			break;
		case 'string':
			return '"' + o.replace(/(["\\])/g, '\\$1') + '"';
		default:
			return String(o);
	}
}var ajaxVersion = '5.7.22.2';




var managealbum = {
addAlbum:function(albumName,callback,context){return new ajax_request(this.url + '?_method=addAlbum&_session=rw','albumName=' + enc(albumName),callback, context);},
modifyAlbumName:function(albumID,albumName,callback,context){return new ajax_request(this.url + '?_method=modifyAlbumName&_session=rw','albumID=' + enc(albumID)+ '\r\nalbumName=' + enc(albumName),callback, context);},
isPublicAlbum:function(albumID,isPublic,callback,context){return new ajax_request(this.url + '?_method=isPublicAlbum&_session=rw','albumID=' + enc(albumID)+ '\r\nisPublic=' + enc(isPublic),callback, context);},
getAlbumPhotoCount:function(albumID,callback,context){return new ajax_request(this.url + '?_method=getAlbumPhotoCount&_session=rw','albumID=' + enc(albumID),callback, context);},
getAlbumCount:function(callback,context){return new ajax_request(this.url + '?_method=getAlbumCount&_session=rw','',callback, context);},
deleteAlbum:function(albumID,movealbumID,deleteType,callback,context){return new ajax_request(this.url + '?_method=deleteAlbum&_session=rw','albumID=' + enc(albumID)+ '\r\nmovealbumID=' + enc(movealbumID)+ '\r\ndeleteType=' + enc(deleteType),callback, context);},
getOtherAlbum:function(albumID,callback,context){return new ajax_request(this.url + '?_method=getOtherAlbum&_session=rw','albumID=' + enc(albumID),callback, context);},
changeOrderNum:function(albumIDs,callback,context){return new ajax_request(this.url + '?_method=changeOrderNum&_session=rw','albumIDs=' + enc(albumIDs),callback, context);},
getAlbumList:function(iCurPage,callback,context){return new ajax_request(this.url + '?_method=getAlbumList&_session=rw','iCurPage=' + enc(iCurPage),callback, context);},
url:'/pomoho_ajax/pomohox.my.managealbum,pomohox.ashx'
}
function HtmlControl(id) {
	var ele = null;
	if(typeof(id) == 'object') ele = id; else ele = document.getElementById(id);
	if(ele == null) return null;
	var _o = ele.cloneNode(true);
	var _op = document.createElement('SPAN');
	_op.appendChild(_o);	
	this._source = _op.innerHTML;
}
HtmlControl.prototype.toString = function(){ return this._source; }

function HtmlControlUpdate(func, parentId) {
var f,i,ff,fa='';
var ele = document.getElementById(parentId);
if(ele == null) return;
var args = [];
for(i=0; i<HtmlControlUpdate.arguments.length; i++)
	args[args.length] = HtmlControlUpdate.arguments[i];
if(args.length > 2)
	for(i=2; i<args.length; i++){fa += 'args[' + i + ']';if(i < args.length -1){ fa += ','; }}
f = '{"invoke":function(args){return ' + func + '(' + fa + ');}}';
ff = null;eval('ff=' + f + ';');
if(ff != null && typeof(ff.invoke) == 'function')
{
	var res = ff.invoke(args);
	if(res.error != null){alert(res.error);return;}
	ele.innerHTML = res.value;
}
}
function TimeSpan(){this.Days=0;this.Hours=0;this.Minutes=0;this.Seconds=0;this.Milliseconds=0;}
TimeSpan.prototype.toString = function(){return this.Days+'.'+this.Hours+':'+this.Minutes+':'+this.Seconds+'.'+this.Milliseconds;}
function digi(v, c){v = v + "";var n = "0000";if(v.length < c) return n.substr(0, c-v.length) + v;return v;}
function DateTime(year,month,day,hours,minutes,seconds){if(year>9999||year<1970||month<1||month>12||day<0||day>31||hours<0||hours>23||minutes<0||minutes>59||seconds<0||seconds>59)throw("ArgumentException");this.Year = year;this.Month = month;this.Day = day;this.Hours = hours;this.Minutes = minutes;this.Seconds = seconds;}
DateTime.prototype.toString = function(){return digi(this.Year,4) + digi(this.Month,2) + digi(this.Day,2) + digi(this.Hours,2) + digi(this.Minutes,2) + digi(this.Seconds,2);}
function _getTable(n,e){for(var i=0; i<e.Tables.length; i++){if(e.Tables[i].Name == n)return e.Tables[i];}return null;}
function AjaxImage(url){var img=new Image();img.src=url;return img;}
